package com.czp.mall.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.czp.mall.pojo.Item;
import com.czp.mall.service.ItemService;

@RestController
public class ItemController {

	@Autowired
	private ItemService itemService;
	
//	@RequestMapping(value = "/item/{id}" ,method = RequestMethod.GET)
	@GetMapping(value = "/item/{id}",produces = {"application/json;charset=UTF-8"})
	public Item queryItemById(@PathVariable(name = "id") Long id) {
		System.out.println("来调用接口了");
		return itemService.findItemById(id);
	}
	
}
